package com.niodata.dp.expression.function.string;

import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.function.FunctionUtils;
import com.googlecode.aviator.runtime.type.AviatorObject;
import java.util.Map;

public class StringLowerCaseFunction extends AbstractFunction {

  @Override
  public String getName() {
    return "string.lower";
  }

  public AviatorObject call(Map<String, Object> env, AviatorObject str) {
    String value = FunctionUtils.getStringValue(str, env);
    String lower = value.toLowerCase();
    return FunctionUtils.wrapReturn(lower);
  }
}
